<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="moban::head">
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <!--横切菜单-->
    <div th:replace="moban::h_menu"></div>
    <!--纵切菜单-->
    <div th:replace="moban::v_menu"></div>
    <!--内容主体-->
    <div class="layui-body">
        <div class="layui-btn-group" style="margin-top: 10px;margin-left: 30px">
            <button class="layui-btn layui-btn-normal" id="add">新增类别</button>
        </div>
        <div class="layui-form-item" style="float: right;margin-top: 10px;margin-right: 500px">
            <div class="layui-input-inline">
                <input type="text" id="categoryid" name="categoryid" lay-verify="categoryid" placeholder="请输入类别ID" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" id="categoryname" name="categoryname" lay-verify="categoryname" placeholder="请输入类别名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="float: right;margin-top: -53px;margin-right: 335px">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-primary" id="ss">搜索</button>
            </div>
            <!--<div class="layui-input-inline">-->
                <!--<button class="layui-btn layui-btn-primary" id="ss">搜索</button>-->
            <!--</div>-->
        </div>
        <div>
            <table class="layui-table" id="tablexx" lay-filter="demo"></table>
        </div>
    </div>
    <!--底部固定区域-->
    <div th:replace="moban::foot"></div>
</div>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-1.8.3.min.js"></script>
<script src="/js/categroy_list.js" ></script>

<script>
    var $ = layui.jquery;
    $(function () {
        $("#add").click(function () {
            layer.open({
                type: 2,
                content: '/addcategory',//这里content是一个普通的String
                area: ['680px', '400px']
            })
        });
        $("#ss1").click(function () {
            var categoryid = $("#categoryid").val();//获取文本框中的数据
            alert(categoryid);
            findAll('/getBy_Id',{"categoryid":categoryid});
        });
        $("#ss").click(function () {
            var categoryname=$("#categoryname").val();
//                alert(categoryname);
                findAll('/ByIdAndName',{"categoryname":categoryname});
//            $.ajax({
//                type:"get",
//                dataType:"json",
//                url:"/getBy_Id?categoryid="+i_d,
//                data:$("#tablexx")
//            })
            });
        });


</script>
</body>
</html>